package vn.edu.saigontech.ncms.web;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.views.freemarker.FreemarkerManager;
import org.apache.struts2.views.freemarker.ScopesHashModel;

import vn.edu.saigontech.ncms.service.DayOffService;
import vn.edu.saigontech.ncms.service.ParameterService;
import vn.edu.saigontech.ncms.service.TeacherService;
import vn.edu.saigontech.ncms.service.TeachingInterruptionService;
import vn.edu.saigontech.ncms.service.UserService;
import vn.edu.saigontech.ncms.util.CollectionUtil;
import vn.edu.saigontech.ncms.util.DateUtil;
import vn.edu.saigontech.ncms.util.NumberUtil;
import vn.edu.saigontech.ncms.util.UnicodeUtil;

import com.opensymphony.xwork2.util.ValueStack;

public class CustomFreemarkerManager extends FreemarkerManager {
	
    protected void populateContext(ScopesHashModel model, ValueStack stack, Object action, HttpServletRequest request, HttpServletResponse response) {
        super.populateContext(model, stack, action, request, response);
        model.put("now", new Date());
        model.put("CollectionUtil", new CollectionUtil());
        model.put("DateUtil", new DateUtil());
        model.put("UnicodeUtil", new UnicodeUtil());
        model.put("NumberUtil", new NumberUtil());
        model.put("View", new View());
        model.put("TeacherService", TeacherService.INSTANCE);
        model.put("UserService", UserService.INSTANCE);
        model.put("OfferingService", TeacherService.INSTANCE);
        model.put("TeachingInterruptionService", TeachingInterruptionService.INSTANCE);
        model.put("DayOffService", DayOffService.INSTANCE);
        model.put("ParameterService", ParameterService.INSTANCE);
    }
}